.class Lrexsee/network/RexseeBluetooth$BluetoothConnection;
.super Ljava/lang/Thread;
.source "RexseeBluetooth.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lrexsee/network/RexseeBluetooth;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "BluetoothConnection"
.end annotation


# instance fields
.field final synthetic this$0:Lrexsee/network/RexseeBluetooth;


# direct methods
.method private constructor <init>(Lrexsee/network/RexseeBluetooth;)V
    .locals 0

    .prologue
    .line 952
    iput-object p1, p0, Lrexsee/network/RexseeBluetooth$BluetoothConnection;->this$0:Lrexsee/network/RexseeBluetooth;

    invoke-direct {p0}, Ljava/lang/Thread;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Lrexsee/network/RexseeBluetooth;Lrexsee/network/RexseeBluetooth$BluetoothConnection;)V
    .locals 0

    .prologue
    .line 952
    invoke-direct {p0, p1}, Lrexsee/network/RexseeBluetooth$BluetoothConnection;-><init>(Lrexsee/network/RexseeBluetooth;)V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 9

    .prologue
    .line 955
    iget-object v5, p0, Lrexsee/network/RexseeBluetooth$BluetoothConnection;->this$0:Lrexsee/network/RexseeBluetooth;

    const/4 v6, 0x2

    # invokes: Lrexsee/network/RexseeBluetooth;->setConnectState_(I)V
    invoke-static {v5, v6}, Lrexsee/network/RexseeBluetooth;->access$10(Lrexsee/network/RexseeBluetooth;I)V

    .line 957
    :try_start_0
    iget-object v5, p0, Lrexsee/network/RexseeBluetooth$BluetoothConnection;->this$0:Lrexsee/network/RexseeBluetooth;

    # getter for: Lrexsee/network/RexseeBluetooth;->mSocket:Landroid/bluetooth/BluetoothSocket;
    invoke-static {v5}, Lrexsee/network/RexseeBluetooth;->access$8(Lrexsee/network/RexseeBluetooth;)Landroid/bluetooth/BluetoothSocket;

    move-result-object v5

    invoke-virtual {v5}, Landroid/bluetooth/BluetoothSocket;->getInputStream()Ljava/io/InputStream;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1

    move-result-object v3

    .line 960
    .local v3, "inputStream":Ljava/io/InputStream;
    :goto_0
    :try_start_1
    invoke-virtual {v3}, Ljava/io/InputStream;->available()I

    move-result v4

    .line 961
    .local v4, "length":I
    if-nez v4, :cond_0

    .line 962
    const-wide/16 v5, 0x64

    invoke-static {v5, v6}, Ljava/lang/Thread;->sleep(J)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1

    goto :goto_0

    .line 970
    .end local v4    # "length":I
    :catch_0
    move-exception v5

    move-object v2, v5

    .line 971
    .local v2, "e":Ljava/lang/Exception;
    :try_start_2
    iget-object v5, p0, Lrexsee/network/RexseeBluetooth$BluetoothConnection;->this$0:Lrexsee/network/RexseeBluetooth;

    # getter for: Lrexsee/network/RexseeBluetooth;->mBrowser:Lrexsee/core/browser/Browser;
    invoke-static {v5}, Lrexsee/network/RexseeBluetooth;->access$1(Lrexsee/network/RexseeBluetooth;)Lrexsee/core/browser/Browser;

    move-result-object v5

    iget-object v5, v5, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v6, "onBluetoothConnectionLost"

    invoke-virtual {v5, v6}, Lrexsee/core/browser/clazz/EventList;->run(Ljava/lang/String;)V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_1

    .line 977
    .end local v2    # "e":Ljava/lang/Exception;
    .end local v3    # "inputStream":Ljava/io/InputStream;
    :goto_1
    return-void

    .line 964
    .restart local v3    # "inputStream":Ljava/io/InputStream;
    .restart local v4    # "length":I
    :cond_0
    :try_start_3
    new-array v0, v4, [B

    .line 965
    .local v0, "buffer":[B
    invoke-virtual {v3, v0}, Ljava/io/InputStream;->read([B)I

    .line 966
    new-instance v1, Ljava/lang/String;

    iget-object v5, p0, Lrexsee/network/RexseeBluetooth$BluetoothConnection;->this$0:Lrexsee/network/RexseeBluetooth;

    # getter for: Lrexsee/network/RexseeBluetooth;->mBrowser:Lrexsee/core/browser/Browser;
    invoke-static {v5}, Lrexsee/network/RexseeBluetooth;->access$1(Lrexsee/network/RexseeBluetooth;)Lrexsee/core/browser/Browser;

    move-result-object v5

    iget-object v5, v5, Lrexsee/core/browser/Browser;->application:Lrexsee/core/application/RexseeApplication;

    invoke-virtual {v5}, Lrexsee/core/application/RexseeApplication;->getDefaultEncoding()Ljava/lang/String;

    move-result-object v5

    invoke-direct {v1, v0, v5}, Ljava/lang/String;-><init>([BLjava/lang/String;)V

    .line 967
    .local v1, "data":Ljava/lang/String;
    invoke-static {v1}, Lrexsee/core/utilities/Escape;->escape(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    .line 968
    iget-object v5, p0, Lrexsee/network/RexseeBluetooth$BluetoothConnection;->this$0:Lrexsee/network/RexseeBluetooth;

    # getter for: Lrexsee/network/RexseeBluetooth;->mBrowser:Lrexsee/core/browser/Browser;
    invoke-static {v5}, Lrexsee/network/RexseeBluetooth;->access$1(Lrexsee/network/RexseeBluetooth;)Lrexsee/core/browser/Browser;

    move-result-object v5

    iget-object v5, v5, Lrexsee/core/browser/Browser;->eventList:Lrexsee/core/browser/clazz/EventList;

    const-string v6, "onBluetoothDataRead"

    const/4 v7, 0x1

    new-array v7, v7, [Ljava/lang/String;

    const/4 v8, 0x0

    aput-object v1, v7, v8

    invoke-virtual {v5, v6, v7}, Lrexsee/core/browser/clazz/EventList;->run(Ljava/lang/String;[Ljava/lang/String;)V
    :try_end_3
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_0
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_1

    goto :goto_0

    .line 975
    .end local v0    # "buffer":[B
    .end local v1    # "data":Ljava/lang/String;
    .end local v3    # "inputStream":Ljava/io/InputStream;
    .end local v4    # "length":I
    :catch_1
    move-exception v5

    goto :goto_1
.end method
